<?php


class Subscriber extends CActiveRecord
{
    public $Vzdmx1mdrg1b;
    public $Vmtvowe0vl01;
	
	public static function model($Vgmajjibziuy=__CLASS__)
	{
		return parent::model($Vgmajjibziuy);
	}

	
	public function tableName()
	{
		return 'subscriber';
	}

	
	public function rules()
	{
		
		
		return array(
			array('user_name', 'required'),
			array('status, last_login_session, sex', 'numerical', 'integerOnly'=>true),
			array('subscriber_number', 'length', 'max'=>45),
			array('user_name', 'length', 'max'=>100),
			array('email', 'length', 'max'=>300),
			array('full_name, password', 'length', 'max'=>200),
			array('avatar_url, yahoo_id, google_id, zing_id, facebook_id', 'length', 'max'=>255),
			array('status_log, last_login_time, birthday, create_date, modify_date', 'safe'),
			
			
			array('id, subscriber_number, user_name, status, status_log, email, full_name, password, last_login_time, last_login_session, birthday, sex, avatar_url, yahoo_id, google_id, zing_id, facebook_id, create_date, modify_date', 'safe', 'on'=>'search'),
		);
	}

	
	public function relations()
	{
		
		
		return array(
			'contentTokens' => array(self::HAS_MANY, 'ContentToken', 'subscriber_id'),
			'liveComments' => array(self::HAS_MANY, 'LiveComment', 'subscriber_id'),
			'liveLikeDislikes' => array(self::HAS_MANY, 'LiveLikeDislike', 'subscriber_id'),
			'liveRatings' => array(self::HAS_MANY, 'LiveRating', 'subscriber_id'),
			'liveSearchHistories' => array(self::HAS_MANY, 'LiveSearchHistory', 'subscriber_id'),
			'liveSubscriberFavorites' => array(self::HAS_MANY, 'LiveSubscriberFavorite', 'subscriber_id'),
			'serviceSubscriberMappings' => array(self::HAS_MANY, 'ServiceSubscriberMapping', 'subscriber_id'),
			'lastLoginSession' => array(self::BELONGS_TO, 'SubscriberSession', 'last_login_session'),
			'subscriberActivityLogs' => array(self::HAS_MANY, 'SubscriberActivityLog', 'subscriber_id'),
			'subscriberContentAccessLogs' => array(self::HAS_MANY, 'SubscriberContentAccessLog', 'subscriber_id'),
			'subscriberFeedbacks' => array(self::HAS_MANY, 'SubscriberFeedback', 'subscriber_id'),
			'subscriberGroupMappings' => array(self::HAS_MANY, 'SubscriberGroupMapping', 'subscriber_id'),
			'subscriberNotificationFilters' => array(self::HAS_MANY, 'SubscriberNotificationFilter', 'subscriber_id'),
			'subscriberNotificationInboxes' => array(self::HAS_MANY, 'SubscriberNotificationInbox', 'subscriber_id'),
			'subscriberSessions' => array(self::HAS_MANY, 'SubscriberSession', 'subscriber_id'),
			'vodComments' => array(self::HAS_MANY, 'VodComment', 'subscriber_id'),
			'vodLikeDislikes' => array(self::HAS_MANY, 'VodLikeDislike', 'subscriber_id'),
			'vodRatings' => array(self::HAS_MANY, 'VodRating', 'subscriber_id'),
			'vodSearchHistories' => array(self::HAS_MANY, 'VodSearchHistory', 'subscriber_id'),
			'vodSubscriberFavorites' => array(self::HAS_MANY, 'VodSubscriberFavorite', 'subscriber_id'),
		);
	}

	
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'subscriber_number' => 'Subscriber Number',
			'user_name' => 'User Name',
			'status' => 'Status',
			'status_log' => 'Status Log',
			'email' => 'Email',
			'full_name' => 'Full Name',
			'password' => 'Password',
			'last_login_time' => 'Last Login Time',
			'last_login_session' => 'Last Login Session',
			'birthday' => 'Birthday',
			'sex' => 'Sex',
			'avatar_url' => 'Avatar Url',
			'yahoo_id' => 'Yahoo',
			'google_id' => 'Google',
			'zing_id' => 'Zing',
			'facebook_id' => 'Facebook',
			'create_date' => 'Create Date',
			'modify_date' => 'Modify Date',
		);
	}

	
	public function search()
	{
		
		

		$V0v5vsnfxezw=new CDbCriteria;

		$V0v5vsnfxezw->compare('id',$this->id);
		$V0v5vsnfxezw->compare('subscriber_number',$this->subscriber_number,true);
		$V0v5vsnfxezw->compare('user_name',$this->user_name,true);
		$V0v5vsnfxezw->compare('status',$this->status);
		$V0v5vsnfxezw->compare('status_log',$this->status_log,true);
		$V0v5vsnfxezw->compare('email',$this->email,true);
		$V0v5vsnfxezw->compare('full_name',$this->full_name,true);
		$V0v5vsnfxezw->compare('password',$this->password,true);
		$V0v5vsnfxezw->compare('last_login_time',$this->last_login_time,true);
		$V0v5vsnfxezw->compare('last_login_session',$this->last_login_session);
		$V0v5vsnfxezw->compare('birthday',$this->birthday,true);
		$V0v5vsnfxezw->compare('sex',$this->sex);
		$V0v5vsnfxezw->compare('avatar_url',$this->avatar_url,true);
		$V0v5vsnfxezw->compare('yahoo_id',$this->yahoo_id,true);
		$V0v5vsnfxezw->compare('google_id',$this->google_id,true);
		$V0v5vsnfxezw->compare('zing_id',$this->zing_id,true);
		$V0v5vsnfxezw->compare('facebook_id',$this->facebook_id,true);
		$V0v5vsnfxezw->compare('create_date',$this->create_date,true);
		$V0v5vsnfxezw->compare('modify_date',$this->modify_date,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$V0v5vsnfxezw,
		));
	}
	public function isNeverUsed() {
		$V12dcg23h5vz = ServiceSubscriberMapping::model()->findAllByAttributes(array('subscriber_id' => $this->id));
		if(count($V12dcg23h5vz) == 0) {
			return true;
		}
		return false;
	} 
}